<% layout('/layout/default.html', {title: '首页', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa fa-cubes"></i> 首页
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="查询"><i class="fa fa-filter"></i> 查询</a>
					<a href="/sys/xz59list/from" class="btn btn-default btnTool"  title="新增"><i class="fa fa-plus"></i> 新增</a>
			</div>
		</div>
		<div class="box-body">
			<form id="searchForm" action="${ctx}/sys/xz59list/listData" method="post" class="form-inline hide" 
				data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}">
				<div class="form-group">
					<label class="control-label">名称：</label>
					<div class="control-inline">
						<input name="text"  maxlength="100" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">子节点：</label>
					<div class="control-inline">
						<input name="ide"  maxlength="100" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">父节点：</label>
					<div class="control-inline">
						<#form:input path="pid" maxlength="300" class="form-control width-90"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">sql：</label>
					<div class="control-inline">
						<#form:input path="remark" maxlength="300" class="form-control width-90"/>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">查询</button>
					<button type="reset" class="btn btn-default btn-sm">重置</button>
				</div>
			</form>			
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
//初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'名称', name:'text', index:'a.text', width:90, align:"center"},
		{header:'ID', name:'ide', index:'a.ide', width:90, align:"center"},
		{header:'PID', name:'pid', index:'a.pid', width:90, align:"center"},
        {header:'code', name:'code', index:'a.code', width:90, align:"center"},
		{header:'sql', name:'remark', index:'a.remark', width:90, align:"center"},
		{header:'操作', name:'actions', width:200, sortable:false,align:"center", title:false, formatter: function(val, obj, row, act){
			var actions = [];
			var icon = row.loginFlag==1?'title="停用用户" data-confirm="确认要停用该用户吗?"><i class="fa fa-ban':'title="启用用户" data-confirm="确认要启该用户吗?"><i class="fa fa-check-square';
			<% if(hasPermi('sys:user:edit')){ %>
				actions.push('<a href="/sys/xz59list/formXZ?id='+row.id+'&op=edit" class="btnList" title="修改首页"><i class="fa fa-pencil"></i></a>');
				//actions.push('<a href="${ctx}/sys/user/changeStatus?id='+row.id+'&loginFlag='+row.loginFlag+'" class="btnList"'+icon+'"></i></a>');
				actions.push('<a href="${ctx}/sys/xz59list/deleteXZ?id='+row.id+'" class="btnList" title="删除首页信息" data-confirm="确认要删除该用户吗?"><i class="fa fa-trash-o"></i></a>');
			<% } %>
			return actions.join('');
		}}
	],
	
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		console.log(data);
	}
});

</script>